﻿using Mandy.Config.Model;
using Mandy.Config.Model.Param;
using Mandy.Config.Utility;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Mandy.Config.API.Controllers
{
    public class LoginController : BaseAuthController
    {
        public IActionResult SignIn([FromBody] LoginSignInParam Param)
        {
            string ConfigUserName = GlobalContext.SystemConfig.LoginInfo.UserName;
            string ConfigUserPassword = GlobalContext.SystemConfig.LoginInfo.UserPassword;

            if (Param.UserName.ToUpper() == ConfigUserName.ToUpper()
                && Param.UserPassword.ToUpper() == ConfigUserPassword.ToUpper())
            {
                return Json(TResult<int>.BuildResult(1));
            }
            else
            {
                return Json(TResult<int>.BuildResult(0));
            }
        }
    }
}
